/*
 * Copyright 2012 Marsrutai.lt
 * 
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 * 
 *   http://www.apache.org/licenses/LICENSE-2.0
 * 
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package lt.marsrutai.mobile.android.activity.intent;

import lt.marsrutai.mobile.android.cache.UpdateCacheRequest;
import lt.marsrutai.mobile.android.service.impl.DataDownloadService;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;

public class DataDownloadServiceIntentHolder extends IntentHolder {

    private static final String UPDATE_CACHE_REQUEST = "updateCacheRequest";
    private static final String ACTION_START = "actionStart";

    public DataDownloadServiceIntentHolder(Activity sourceActivity) {
        super(sourceActivity, DataDownloadService.class);

        // Start action is default unless otherwise stated.
        setActionStart(true);
    }

    public DataDownloadServiceIntentHolder(Intent intent) {
        super(intent);
    }

    public DataDownloadServiceIntentHolder(Bundle bundle) {
        super(bundle);
    }

    public void setUpdateCacheRequest(UpdateCacheRequest updateCacheRequest) {
        intent.putExtra(UPDATE_CACHE_REQUEST, updateCacheRequest);
    }

    public UpdateCacheRequest getUpdateCacheRequest() {
        return (UpdateCacheRequest) intent.getExtras().get(UPDATE_CACHE_REQUEST);
    }

    public void setActionStart(boolean actionStart) {
        intent.putExtra(ACTION_START, actionStart);
    }

    public boolean getActionStart() {
        return intent.getExtras().getBoolean(ACTION_START);
    }
}
